﻿using System;
using System.Collections;
using System.Collections.Generic;
namespace WPFExcelReport
{
    public class WB18GIReport : BaseReport
    {
        string strCompany = "HLT";
        string strExcelFile = "";
        public WB18GIReport()
            : base()
        {
            AssignColumns();
        }
        public WB18GIReport(Dictionary<string, object> dicParamater)
            : base(dicParamater)
        {
            strCompany = dicParamater["Company"].ToString().Trim();
            strExcelFile = dicParamater["ExcelFile"].ToString().Trim();
            AssignColumns();
        }
        private void AssignColumns()
        {
            columns.Clear();
            columns.Add("WBBDPART"); columns.Add("WBBSTKNR"); columns.Add("WBFKVERSION"); columns.Add("ARTICLE");
            columns.Add("WBFKNEUDAT"); columns.Add("HRNNAME"); columns.Add("WBFKSART"); columns.Add("GRADE");
            columns.Add("YARDQTY");
            columns.Add("REMARK"); 
        }

        public void REPORT2EXCEL(string fileType)
        {
            Queue CellQueue = new Queue(); 
            string filename = "";
            string sheetName = "";
            string Standard = "Warehouse_Piece_Inspection";
            strExcelFile = @"HLT\HLTSummaryReport.xls";
            string filePath = @"C:\intex.w\Report\" + strExcelFile;
            exAgent.Open(filePath);
            exAgent.Company = "";
            exAgent.strExcelFile = strExcelFile;
            string filedate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
            filename = @"Warehouse\布卷检验报告" + filedate + ".xls";
            sheetName = DateTime.Now.ToShortTimeString().Replace(@":", "");
            exAgent.CreateNewSheet(filename, Standard, sheetName);
            FillInData(columns, dsSource.Tables["PIECE_INSPECTION"]);
            if (exAgent != null)
            {
                exAgent.Save();
                exAgent.Close();
            }
        } 
        
    }
    }


